package com.ibsol.view
{
	import mx.skins.RectangularBorder;
	import flash.display.BitmapData;
	import flash.display.Bitmap;

    public class AdminBackground extends RectangularBorder
    {
    	[Embed(source='./assets/background_admin.png')]
        private var backgroundImageClass:Class;
        private var backgroundBitmapData:BitmapData;

        public function AdminBackground()
        {
            super();              
            var backgroundImage:Bitmap = new backgroundImageClass(); 
            backgroundBitmapData = new BitmapData(backgroundImage.width,backgroundImage.height);
           	backgroundBitmapData.draw(backgroundImage);            
        }        
        
        override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number ):void 
        {
            super.updateDisplayList(unscaledWidth,unscaledHeight );
           	var cornerRadius:Number = getStyle("cornerRadius");
            graphics.clear();
            graphics.beginBitmapFill( backgroundBitmapData );
            graphics.drawRoundRectComplex(0,0,unscaledWidth,unscaledHeight,cornerRadius,cornerRadius,cornerRadius,cornerRadius );
            graphics.endFill();
        }        
    }
}